<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
  xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
  <head>
    <script type="text/javascript">
    	var listAdd=function(){
    		$("#listSave").setData({aa:"aa"});
    	}
    	
    	var listSave=function(id){
			if(id != null){
    			$.ajaxData({url:"/org/evaluate/list-group", data:{id:id}, success:function(ret){
    				$("#listSave").setData({data:ret});
    				$("#imgUrl").jjUploadFile({multiple:false,type:"image",data:[{url:ret.imgUrl}]});
            		$("#orgPic").jjUploadFile({multiple:false,type:"image",data:[{url:ret.orgPic}]});
            		
            		var labels = eval("("+ret.labels+")");
            		
            		$("#labels").loadLm({list:labels});
    			}});
    		} else {
    			
    			$("#imgUrl").jjUploadFile({multiple:false,type:"image"});
        		$("#orgPic").jjUploadFile({multiple:false,type:"image"});
        		
        		var labels = eval("("+'[{"name":"姓名","type":"0","text":""},{"name":"年龄","type":"0","text":""},{"name":"作品名称","type":"0","text":""},{"name":"参赛类别","type":"1","text":"舞蹈类,合唱类,服饰模特类,器乐类,其他"},{"name":"专业/非专业","type":"1","text":"专业,非专业"},{"name":"组别","type":"1","text":"幼儿组：4—6周岁,少儿A组：7—9周岁,少儿B组：10—12周岁,少年A组：13—15周岁,少年B组：16—18周岁,青年组：19—24周岁"},{"name":"指导老师","type":"0","text":""},{"name":"联系电话","type":"0","text":""},{"name":"联系地址","type":"0","text":""},{"name":"推荐渠道","type":"0","text":""}]'+")");
        		$("#labels").loadLm(labels);
    		}
    		
			
			
			$(function(){
				setMenu("添加比赛", true)
				
				$.formValidator.initConfig({validatorGroup:"listSaveForm",formID:"listSaveForm",debug:false,onError:function(msg){}});
    			$("#listSaveForm input[name='title']").formValidator({tipID:"titleTip",validatorGroup:"listSaveForm",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,max:50,onError:"*必填"});
    			$("#listSaveForm input[name='area']").formValidator({tipID:"areaTip",validatorGroup:"listSaveForm",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,max:50,onError:"*必填"});
    			$("#listSaveForm textarea[name='description']").formValidator({tipID:"descriptionTip",validatorGroup:"listSaveForm",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,max:300,onError:"*必填"});
    			
    			$("#listSaveForm input[name='publishAt']").formValidator({tipID:"publishAtTip",validatorGroup:"listSaveForm",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,onError:"*必填"});
    			$("#listSaveForm input[name='endAt']").formValidator({tipID:"endAtTip",validatorGroup:"listSaveForm",onShow:"",onFocus:"",onCorrect:""}).inputValidator({min:1,onError:"*必填"});
    			
    			$("#listSaveForm").formsubmit({vg:"listSaveForm",url:"org-brand_save",type:"post", success:function(){
        			}
        		});
			});
			
    			
    		
    	}
    </script>
  </head>
  <body>
  		<div layout:fragment="content" class="content" id="modal">
			<div class="addModal">
				<div class="addModal-top">
					<div class="addModal-title">添加比赛</div>
				</div>
				<div class="addModal-cont">
					<form id="listSaveForm">
					<div class="addModal-form">
						<div class="addModal-group">
							<input type="text" placeholder="比赛名称" name="title" value="#{data.title}#" class="addModal-group-control"/>
							<div class="addModal-valid" id="titleTip"></div>
						</div>									
						<div class="addModal-group">
							<input type="text" placeholder="比赛地点" name="area" value="#{data.area}#" class="addModal-group-control"/>
							<div class="addModal-valid" id="areaTip"></div>
						</div>
						<div class="addModal-group">
							<textarea type="text" placeholder="比赛介绍" name="description" rows="3" class="addModal-group-control">#{data.description}#</textarea>
							<div class="addModal-valid" id="descriptionTip"></div>
						</div>

						<div class="addModal-group addModal-group-50">
							<input type="text" name="publishAt" placeholder="开始时间" value="#{data.publishAt}#" readonly="readonly" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm'})" class="addModal-group-control"/>
							<div class="addModal-valid" id="publishAtTip"></div>
						</div>
						<div class="addModal-group addModal-group-50">
							<input type="text" name="endAt" placeholder="结束时间" value="#{data.endAt}#" readonly="readonly" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm'})" class="addModal-group-control"/>
							<div class="addModal-valid" id="endAtTip"></div>
						</div>	
						<div class="addModal-group addModal-group-50">
							<input type="text" placeholder="金额提示" name="charge" value="#{data.charge}#" class="addModal-group-control"/>
							<div class="addModal-valid" id="chargeTip"></div>
						</div>
						<div class="addModal-group addModal-group-50">
							<input type="text" placeholder="原价提示" name="originalPrice" value="#{data.originalPrice}#" class="addModal-group-control"/>
							<div class="addModal-valid" id="originalPriceTip"></div>
						</div>

						<div class="addModal-group">
							<div class="addModal-group-title">横幅</div>
							<div id="imgUrl" data="modal-static"></div>
							<div class="addModal-valid"></div>
						</div>

						<div class="addModal-group">
							<div class="addModal-group-title">图标</div>
							<div id="orgPic" data="modal-static"></div>
							<div class="addModal-valid"></div>
						</div>

						<div class="addModal-group">
							<div class="addModal-btns">
								<button class="addModal-btn" onclick="listAdd()">保存</button>
							</div>
						</div>

					</div>
					</form>
					<div class="addModal-yl">
						<div class="addModal-yl-top">
							<div class="addModal-yl-title">比赛预览</div>
						</div>
						<iframe src="http://h5.5151study.com/contests/contest-group/#{data.id}#" style="height: 400px;" class="addModal-yl-cont">
						</iframe>						
					</div>

					
				</div>

				<hr/>
				<div class="addModal-top">
					<h3>
						比赛阶段<strong></strong>	
					</h3>
				</div>
				
				<div class="addModal-cont">
					
					<div class="addModal-form">
						<div class="addModal-group">
							<input type="text" placeholder="比赛名称" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>									
						<div class="addModal-group">
							<input type="text" placeholder="比赛地点" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>
						<div class="addModal-group">
							<input type="text" placeholder="比赛名称" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>

						<div class="addModal-group addModal-group-50">
							<input type="text" placeholder="开始时间" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>
						<div class="addModal-group addModal-group-50">
							<input type="text" placeholder="结束时间" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>	
						<div class="addModal-group addModal-group-50">
							<input type="text" placeholder="金额提示" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>
						<div class="addModal-group addModal-group-50">
							<input type="text" placeholder="原价提示" class="addModal-group-control"/>
							<div class="addModal-valid"></div>
						</div>

						<div class="addModal-group">
							<div class="addModal-group-title">报名资料</div>
							<div id="labels" data="modal-static"></div>
						</div>

					</div>
					<div class="addModal-yl">
						<div class="addModal-yl-top">
							<div class="addModal-yl-title">比赛预览</div>
						</div>
						<div class="addModal-yl-cont">
						</div>						
					</div>
				</div>
			</div>
		</div>
  </body>
</html>